var keys;
var loginDialog;
var mediUser = "";
var mediPassword = "";
var mediEncryptedPassword = "";
var maintab;
var isConnected = "true";
var isAdmin = "false";
var ricoTables = new Array();

var externalId ="";
var firstName = "";
var lastName = "";


var swiftui;
var $;
var identifier = "";
var Rico_CONFIG = {
	jsDir : 'assets/ricoClient/js/',
	cssDir : 'assets/ricoClient/css/',
	imgDir : 'assets/ricoClient/images/'
};

var SwiftUI_CONFIG = {
		jsDir : 'assets/SwiftUIClient/js/',
		cssDir : 'assets/SwiftUIClient/css/',
		imgDir : 'assets/SwiftUIClient/images/'
	};


var clientIdentifier = new Date().getTime();

/****
 * 
 * @return
 */
function SelectedValuesArray() {
	this.list = new Array();
	this.dpush = function(thing) {
		if (this.list.indexOf(thing) == -1) /* if unique */
			this.list.push(thing);
	}
	this.dpop = function(thing) {
		var n = this.list.indexOf(thing);
		if (n >= 0)
			this.list.splice(n, 1);
	}
	this.getCount = function() {
		return 0 + this.list.length;
	}
	this.thingSelected = function(isChecked, thing) {
		if (isChecked)
			this.dpush(thing);
		else
			this.dpop(thing);
	}
}



var workflowSelectedIds = new SelectedValuesArray();



var swfu;


/**
 * Layout related.... stuff below
 */

var outerLayout, innerLayout;
/*
*#######################
* OUTER LAYOUT SETTINGS
*#######################
*
* This configuration illustrates how extensively the layout can be customized
* ALL SETTINGS ARE OPTIONAL - and there are more available than shown below
*
* These settings are set in 'sub-key format' - ALL data must be in a nested data-structures
* All default settings (applied to all panes) go inside the defaults:{} key
* Pane-specific settings go inside their keys: north:{}, south:{}, center:{}, etc
*/
var layoutSettings_Outer = {
	name: "outerLayout" // NO FUNCTIONAL USE, but could be used by custom code to 'identify' a layout
	// options.defaults apply to ALL PANES - but overridden by pane-specific settings
,	defaults: {
		size:					"auto"
	,	minSize:				50
	,	paneClass:				"pane" 		// default = 'ui-layout-pane'
	,	resizerClass:			"resizer"	// default = 'ui-layout-resizer'
	,	togglerClass:			"toggler"	// default = 'ui-layout-toggler'
	,	buttonClass:			"button"	// default = 'ui-layout-button'
	,	contentSelector:		".content"	// inner div to auto-size so only it scrolls, not the entire pane!
	,	contentIgnoreSelector:	"span"		// 'paneSelector' for content to 'ignore' when measuring room for content
	,	togglerLength_open:		35			// WIDTH of toggler on north/south edges - HEIGHT on east/west edges
	,	togglerLength_closed:	35			// "100%" OR -1 = full height
	,	hideTogglerOnSlide:		true		// hide the toggler when pane is 'slid open'
	,	togglerTip_open:		"Close This Pane"
	,	togglerTip_closed:		"Open This Pane"
	,	resizerTip:				"Resize This Pane"
	//	effect defaults - overridden on some panes
	,	fxName:					"slide"		// none, slide, drop, scale
	,	fxSpeed_open:			750
	,	fxSpeed_close:			1500
	,	fxSettings_open:		{ easing: "easeInQuint" }
	,	fxSettings_close:		{ easing: "easeOutQuint" }
}
,	north: {
		size:					95
	,	spacing_open:			1			// cosmetic spacing
	,	togglerLength_open:		0			// HIDE the toggler button
	,	togglerLength_closed:	-1			// "100%" OR -1 = full width of pane
	,	resizable: 				false
	,	slidable:				false
	//	override default effect
	,	fxName:					"none"
	}
,	south: {
		maxSize:				28
	,	spacing_closed:			0			// HIDE resizer & toggler when 'closed'
	,	slidable:				false		// REFERENCE - cannot slide if spacing_closed = 0
	,	initClosed:				false
	,   resizable: 				false
	//	CALLBACK TESTING...
	,	onhide_start:			function () {} //return confirm("START South pane hide \n\n onhide_start callback \n\n Allow pane to hide?"); }
	,	onhide_end:				function () { } //alert("END South pane hide \n\n onhide_end callback"); }
	,	onshow_start:			function () { } //return confirm("START South pane show \n\n onshow_start callback \n\n Allow pane to show?"); }
	,	onshow_end:				function () { } //alert("END South pane show \n\n onshow_end callback"); }
	,	onopen_start:			function () { } //return confirm("START South pane open \n\n onopen_start callback \n\n Allow pane to open?"); }
	,	onopen_end:				function () { } //alert("END South pane open \n\n onopen_end callback"); }
	,	onclose_start:			function () { } //return confirm("START South pane close \n\n onclose_start callback \n\n Allow pane to close?"); }
	,	onclose_end:			function () { } //alert("END South pane close \n\n onclose_end callback"); }
	,	onresize_start:			function () { } //return confirm("START South pane resize \n\n onresize_start callback \n\n Allow pane to be resized?)"); }
	,	onresize_end:			function () { } //alert("END South pane resize \n\n onresize_end callback \n\n NOTE: onresize_start event was skipped."); }
	}
,	west: {
		size:					250
	,   resizable: 				true	
	,	spacing_closed:			21			// wider space when closed
	,	togglerLength_closed:	21			// make toggler 'square' - 21x21
	,   togglerContent_closed:  "M<br/>E<br/>N<br/>U"
	,	togglerAlign_closed:	"top"		// align to top of resizer
	,	togglerLength_open:		0			// NONE - using custom togglers INSIDE west-pane
	,	togglerTip_open:		"Close West Pane"
	,	togglerTip_closed:		"Open West Pane"
	,	resizerTip_open:		"Resize West Pane"
	,	slideTrigger_open:		"click" 	// default
	,	initClosed:				false
	//	add 'bounce' option to default 'slide' effect
	,	fxSettings_open:		{ easing: "easeOutBounce" }
	}
,	east: {
		size:					350
	,	spacing_closed:			21			// wider space when closed
	,	togglerLength_closed:	21			// make toggler 'square' - 21x21
	,	togglerAlign_closed:	"top"		// align to top of resizer
	,	togglerLength_open:		0 			// NONE - using custom togglers INSIDE east-pane
	,	togglerTip_open:		"Close East Pane"
	,	togglerTip_closed:		"Open East Pane"
	,	resizerTip_open:		"Resize East Pane"
	,	slideTrigger_open:		"click"
	,	resizable: 				true		
	//,	slideTrigger_open:		"mouseover"	
	,	initClosed:				false
	//	override default effect, speed, and settings
	,	fxName:					"drop"
	,	fxSpeed:				"normal"
	,	fxSettings:				{ easing: "" } // nullify default easing
	}
,	center: {
		paneSelector:			"#mainContent" 			// sample: use an ID to select pane instead of a class
	,	onresize:				"innerLayout.resizeAll"	// resize INNER LAYOUT when center pane resizes
	}
};

